package com.mtzqc.common.init.impl

import android.app.Application
import com.didi.drouter.annotation.Service
import com.mtzqc.common.init.InitService
import com.mtzqc.common.task.ITask
import me.jessyan.autosize.AutoSizeCompat
import me.jessyan.autosize.AutoSizeConfig

@Service(function = [InitService::class], priority = 110)
class AutoSizeRegister : InitService {
    override val depName: String
        get() = "AutoSize"
    override val dependsLib: Array<Class<out ITask>>?
        get() = null
    override val depends: Array<String>?
        get() = null

    override fun executeInit(app: Application, debug: Boolean, dev: Boolean): Boolean {
        AutoSizeConfig.getInstance().apply {
            setLog(debug)
            //App 内的字体的大小将不会跟随系统设置中字体大小的改变
            isExcludeFontScale = true
        }.setLog(debug)
        AutoSizeCompat.autoConvertDensityOfGlobal(app.resources)
        return true
    }

    override val priority: Int
        get() = 110
}